#!/bin/sh
# 
# do some preparation before run
#

APPNAME=dae

# work dir
WORKDIR=$HOME/tmp/$APPNAME
TTDIR=$WORKDIR/tt

[ -d $TTDIR ] || mkdir -p $TTDIR
[ -d $TTDIR ] && rm -f $TTDIR/*

# start tokyo-tyrant server
TTServer="$HOME/opt/bin/ttserver"

$TTServer -port 1978 -dmn -thnum 4 -pid $TTDIR/tt.pid -log $TTDIR/run.log -le -ulog $TTDIR/ulog -sid 1 $TTDIR/$APPNAME.tch#bnum=10485760
if [ $? -eq 0 ]; then
	echo 'ttserver started.'
else 
	echo 'fail to start ttserver!'
	exit 1
fi

exit 0

